/**
 * 文件名：BigScreenDataServiceImpl.java
 *
 * 创建人：虞云波 - .com
 *
 * 创建时间：2017年12月12日 下午3:22:31
 *
 * 版权所有：江苏晟邦网络科技有限公司
 */
package com.cbwl.eoas.report.service.impl;

import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import com.cbwl.eoas.common.util.BigDecimalUtil;
import com.cbwl.eoas.report.api.data.IBigScreenDataService;
import com.cbwl.eoas.report.dao.data.IBigScreenDataDao;



/**
 * <p>[描述信息：说明类的基本功能]</p>
 *
 * @author 虞云波 - yuyunbo@3856.cc
 * @version 1.0 Created on 2017年12月12日 下午3:22:31
 */
@Service("bigScreenDataService")
public class BigScreenDataServiceImpl implements IBigScreenDataService{
	
	//注入缓存
	
	@Autowired
	private IBigScreenDataDao ibigScreenDataDao;
	
	

	@Override
	public List<Map<String, String>> queryOrderNumByProvince() {
		return ibigScreenDataDao.queryOrderNumByProvince();
	}

	@Override
	public List<Map<String, String>> queryProportionByProvince() {
		
		List<Map<String, String>> list = ibigScreenDataDao.queryProportionByProvince();
		AtomicLong sum = new AtomicLong(0L);
		list.forEach(m ->{
			if(!StringUtils.isEmpty(m.get("value"))){
				sum.addAndGet(Long.valueOf(String.valueOf(m.get("value"))));
			}
		});
		
		list.forEach(m ->{
			if(!StringUtils.isEmpty(m.get("value"))){
				long value = Long.valueOf(String.valueOf(m.get("value")));
				 m.put("s",  BigDecimalUtil.div(value, sum, 4).toString());
			}
		});
		
		return list;
	}

	@Override
	public List<Map<String, String>> queryDataByBigArea() {
		
		List<Map<String, String>> list = ibigScreenDataDao.queryDataByBigArea();
		list.forEach(map ->{
			if(!StringUtils.isEmpty(map.get("y"))){
				long value = Long.valueOf(String.valueOf(map.get("y")));
				map.put("y",  BigDecimalUtil.div(value,10000, 1).toString());
			}
		});
		
		return list;
	}

	@Override
	public Map<String, String> queryLanShouRate() {
		return ibigScreenDataDao.queryLanShouRate();
	}

	@Override
	public Map<String, String> queryXiaZhanRate() {
		return ibigScreenDataDao.queryXiaZhanRate();
	}

	@Override
	public Map<String, String> queryLinShouRate() {
		return ibigScreenDataDao.queryLinShouRate();
	}

	@Override
	public Map<String, String> queryTuoTouRate() {
		return ibigScreenDataDao.queryTuoTouRate();
	}

	
	@Override
	public List<Map<String, String>> queryTargetDataByProvince() {
		return ibigScreenDataDao.queryTargetDataByProvince();
	}

	
	@Override
	public Map<String, String> queryTotalNum() {
		return ibigScreenDataDao.queryTotalNum();
	}

	@Override
	public List<Map<String, String>> queryTargetDataByWarehouse() {
		return ibigScreenDataDao.queryTargetDataByWarehouse();
	}

	@Override
	public List<Map<String, String>> queryTargetDataByAll() {
		return ibigScreenDataDao.queryTargetDataByAll();
	}

	@Override
	public List<Map<String, String>> queryBrokenLine() {
		return ibigScreenDataDao.queryBrokenLine();
	}

	
	
	
}
